Skip to content

feat: add sd-jwt with jades support package #280

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

lukasjhan
Copy link
Member

SD-JWT with JAdES package is moved from https://github.com/openwallet-foundation-labs/sd-jwt-vc-dm

@lukasjhan lukasjhan force-pushed the feat/sd-jwt-with-jades branch from 415447d to 419c7c0 Compare May 28, 2025 04:49
lukasjhan added 2 commits May 28, 2025 15:07
Signed-off-by: Lukas.J Han <[email protected]>
Signed-off-by: Lukas.J Han <[email protected]>
Comment on lines 1 to 17
# SD JWT VCDM Typescript

> ⚠️ **Platform Support**: This package currently supports Node.js environments only.

Typescript implementation of SD JWT VCDM profile.

A library that integrates SD-JWT with W3C Verifiable Credentials Data Model and implements JAdES digital signature standards.

## Features

### SD-JWT VCDM Data Model Profile

This library provides interoperability between SD-JWT (Selective Disclosure JWT) and W3C Verifiable Credentials Data Model:

- Issue Verifiable Digital Credentials in SD-JWT VC format while maintaining W3C VCDM compliance
- Support for Selective Disclosure capabilities
- Seamless integration with standard VC verification processes
Copy link
Contributor

@cre8 cre8 May 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is sd jwt vcdm mentioned here when this packages is just about jades signatures?

When the jads lib can be used independently from sd jwt vc or sd jwt vc dm, I would focus first only on the jades part and then in another chapter how it will be used for sd jwt vc or sd jwt vcdm

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sry I didn't edit the readme. It's about jades only. You are right

await jades
.setProtectedHeader({
alg: 'RS256',
typ: 'jades',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

must the type be jades? I would assume it has to be something like dc+sd-jwt

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, It's just an example :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I suggest to use the default value to not confuse people :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. good idea

!generalJsonCredential.disclosures ||
generalJsonCredential.disclosures.length === 0
) {
console.log(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove console output (and the whole if statement), or change it to console.debug.


return isValid;
} catch (error) {
console.error('JWT token verification error:', error);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would avoid to print errors to the console, it's just good for debugging, but not for production.

lukasjhan added 2 commits June 8, 2025 21:59
Signed-off-by: Lukas.J.Han <[email protected]>
Signed-off-by: Lukas.J.Han <[email protected]>
@lukasjhan lukasjhan requested a review from cre8 June 8, 2025 12:59
},
],
})
.sign(privateKey, kid);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it also possible to get the hash so I do not need to pass the private key? In most situations when using JADES, the key is managed in an HSM. So we need to receive the values to sign it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see, I didn't think about use cases with HSM.
Perhaps would signer function as a parameter be better?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, I'll add that function :)

@cre8
Copy link
Contributor

cre8 commented Jun 23, 2025

@lukasjhan can you pls fix the conflict of the lock file?

@lukasjhan
Copy link
Member Author

@lukasjhan can you pls fix the conflict of the lock file?

Sure 😃

@lukasjhan
Copy link
Member Author

@cre8 I resolved the conflict. and I'm working on implementing getting hash function.
Should I implement to support custom signer and verifier?

@cre8
Copy link
Contributor

cre8 commented Jun 23, 2025

@cre8 I resolved the conflict. and I'm working on implementing getting hash function.
Should I implement to support custom signer and verifier?

For jades it's a must have to be able to use HSMs. Therefore we need to be able to extract the data without the need to pass the private key to the service.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants